Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Remove instanceof Error checks from is methods #1162

Merged
merged 2 commits into from
Jul 7, 2023

Conversation

bergundy
Copy link
Member

@bergundy bergundy commented Jul 6, 2023

This doesn't work when errors are passed from different v8 contexts.
Only known to affect ShutdownError with jest (see jestjs/jest#2549).

@bergundy bergundy requested a review from a team as a code owner July 6, 2023 08:12
@bergundy
Copy link
Member Author

bergundy commented Jul 6, 2023

@mjameswh I'm debating at least adding a typeof err === 'object' for some basic sanity.
WDYT?

@mjameswh
Copy link
Contributor

mjameswh commented Jul 6, 2023

I'm debating at least adding a typeof err === 'object' for some basic sanity.

Well... If you go that way, then you can remove the optional chain operator after that.

But TBH I don't think that's useful. As far as I can think of, the only case where a typeof check before the optional chain operator would make any difference is if the left part is an unresolvable reference (e.g. a variable that doesn't exist), which is impossible in the context of these methods, as error is a function argument.

@CLAassistant
Copy link

CLAassistant commented Jul 6, 2023

CLA assistant check
All committers have signed the CLA.

@mjameswh mjameswh enabled auto-merge (squash) July 7, 2023 15:20
Copy link
Contributor

@mjameswh mjameswh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@mjameswh mjameswh merged commit 93a4d9c into temporalio:main Jul 7, 2023
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants